/*
 * @File: 
 * @Author: Cc
 * @Date: 2022-04-02 16:25:31
 * @LastEditors: Cc
 * @LastEditTime: 2022-04-02 16:27:35
 * @FilePath: \test-unicorn\src\pages\webSoket\index.js
 */
const webSoket = require("ws");
const ws = new webSoket.Server({port: 8000});
ws.on('connection', ws => {
  console.log('server connection')

  ws.on('message', msg => {
    console.log('服务端接收的消息：', msg)
    ws.send('HeartBeat')
  })

  ws.send('连接已建立')
})